package cn.initcap.designpattern.pattern.structural.composite;

/**
 * 组合模式
 *
 * @author initcap
 * @date 2018/8/28 AM9:11
 */
public class Test {
    public static void main(String[] args) {
        BaseCatalogComponent linuxCourse = new Course("Linux", 11);
        BaseCatalogComponent windowsCourse = new Course("Windows", 11);

        BaseCatalogComponent javaCourseCatalog = new CourseBaseCatalog("Java", 2);

        BaseCatalogComponent mmallCourse1 = new Course("Java", 55);
        BaseCatalogComponent mmallCourse2 = new Course("Java电商", 66);
        BaseCatalogComponent designPattern = new Course("设计模式", 77);

        javaCourseCatalog.add(mmallCourse1);
        javaCourseCatalog.add(mmallCourse2);
        javaCourseCatalog.add(designPattern);

        BaseCatalogComponent imoocMainCourseCatalog = new CourseBaseCatalog("主目录", 1);
        imoocMainCourseCatalog.add(linuxCourse);
        imoocMainCourseCatalog.add(windowsCourse);
        imoocMainCourseCatalog.add(javaCourseCatalog);

        imoocMainCourseCatalog.print();


    }
}
